//
//  BackPageViewController.m
//  QRMaster
//
//  Created by myApple on 16/5/27.
//  Copyright © 2016年 myApple. All rights reserved.
//

#import "BackPageViewController.h"
#import "WXXTabClickPageController.h"
#import "QuickCardController.h"
#import "MianViewController.h"
#import "FunctionViewController.h"
#import "CommonCardViewController.h"
@interface BackPageViewController ()<WXXPageControllerDataSource>
{
    NSArray * pageTitleArray;
}

@end

@implementation BackPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = NSLocalizedString(@"loginTitle", @"锁掌柜");
    [self addPagerController];
    // Do any additional setup after loading the view.
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    pageTitleArray = @[NSLocalizedString(@"quickCardSegment", nil),NSLocalizedString(@"常用卡", nil),NSLocalizedString(@"functionCard", nil)];
}

- (void)addPagerController
{
    WXXTabClickPageController *pagerController = [[WXXTabClickPageController alloc]init];
    pagerController.dataSource = self;
    pagerController.adjustStatusBarHeight = YES;
    //pagerController.cellWidth = 56;
    pagerController.cellSpacing = 8;
    pagerController.barStyle = TYPagerBarStyleProgressView;
    pagerController.progressWidth = 36;
    pagerController.view.frame = self.view.bounds;
    [self addChildViewController:pagerController];
    [self.view addSubview:pagerController.view];
}

#pragma mark - TYPagerControllerDataSource

- (NSInteger)numberOfControllersInPageController
{
    return 3;
}

- (NSString *)pagerController:(WXXPageController *)pagerController titleForIndex:(NSInteger)index
{
    return pageTitleArray[index];
}

- (UIViewController *)pagerController:(WXXPageController *)pagerController controllerForIndex:(NSInteger)index
{
    if (index == 0) {
        QuickCardController *VC = [[QuickCardController alloc]init];
        return VC;
    }else if (index == 1) {
//        MianViewController *VC = [[MianViewController alloc]init];
        CommonCardViewController *VC = [[CommonCardViewController alloc]init];
        return VC;
    }else {
        FunctionViewController *VC = [[FunctionViewController alloc]init];
        return VC;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
